<?php 
	
	$ssFilter = $this->arrParam['ssFilter'];
	$action_link 	= $this->baseUrl($this->currentController . '/filter/type/order');
	$App_name 		= $this->cmsLinkSort('App_name','d.name_app',$ssFilter,
										$this->imgUrl . '/icon',$action_link);
	
	$lblStatus		= $this->cmsLinkSort('Status','d.status',$ssFilter,
										$this->imgUrl . '/icon',$action_link);
										
	$lblAppLink		= $this->cmsLinkSort('Link_app','d.link_app',$ssFilter,
										$this->imgUrl . '/icon',$action_link);			

	$lblImgLink		= $this->cmsLinkSort('Link_img','d.link_img',$ssFilter,
										$this->imgUrl . '/icon',$action_link);

	$lblStar		= $this->cmsLinkSort('Star','d.star',$ssFilter,
			$this->imgUrl . '/icon',$action_link);
	
	$lblDateUpload 	= $this->cmsLinkSort('Date_Upload','d.date_upload',$ssFilter,
										$this->imgUrl . '/icon',$action_link);																	

	$lblDescription = $this->cmsLinkSort('Description','d.des_app',$ssFilter,
										$this->imgUrl . '/icon',$action_link);
	
	$lblDownload 	= $this->cmsLinkSort('Download','d.number_download',$ssFilter,
			$this->imgUrl . '/icon',$action_link);
	
	$lblId 			= $this->cmsLinkSort('Id','d.id',$ssFilter,
			$this->imgUrl . '/icon',$action_link);
	
	$lblGroup 		= $this->cmsLinkSort('Group','d.group_app',$ssFilter,
			$this->imgUrl . '/icon',$action_link);
	
		


	//-------------------CREATE GROUP SELECTBOX ------------------------
	$linkSlbGroup = $this->baseUrl($this->currentController . '/filter/type/group');
	$options = $this->groupApp;
	$groupApp = $this->formSelect('group_id',$ssFilter['group_id'],
									array('onchange'=>"OnSubmitForm('" . $linkSlbGroup . "')"),
									$options);
	$selectGroup = 'Group: ' . $groupApp;
	
	//CREATE SEARCH AREA
	$keywords = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort'));
	$linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
	$btnSearch = $this->formButton('search-now','Search now',
									array('onclick'=>"OnSubmitForm('" . $linkSearch . "')"));
	$linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');							
	$btnResetSearch = $this->formButton('clear-keywords','Clear',
									array('onclick'=>"OnSubmitForm('" . $linkResetSearch . "')"));	
	 $strSearch = $keywords . ' ' . $btnSearch . ' ' . $btnResetSearch;																
?>
<form name="appForm" method="post" action="">



                        <?php echo $this->render('developer-production/toolbar/index.php')?>
                        <div class="clr"></div>
                         <?php echo $this->render('developer-production/sublink/index.php')?>

                        <!-- BEGIN: CONTENT -->
                        <div id="element-box">
                            <div class="t">
                                <div class="t">
                                    <div class="t"></div>
                                </div>
                            </div>
                            <div class="m">
                                <!-- BEGIN: ELEMENT BOX -->
								<div id="filters">
									<div style="float:left;">
										<?php echo $strSearch;?>
									</div>
									<div  style="float:right;">
										<?php echo $selectGroup;?>
									</div>
									<div class="clr"></div>
								</div>	

                                <!-- Area 4: In du lieu lay tu database -->
                                <table class="adminlist">
                                    <thead>
                                        <tr>
                                            <th width="43" >
                                            	<input type="checkbox" name="checkbox" id="checkbox" onclick="checkedAll()">
                                           	</th>
                                            	<th><?php echo $App_name?></th>
												<th width="50"><?php echo $lblStatus?></th>
												<th width="150"><?php echo $lblAppLink ?> </th>
												<th width="86"><?php echo $lblImgLink?></th>
												<th width="86"><?php echo $lblStar?></th>
												<th width="77"><?php echo $lblDateUpload?></th>
												<th width="90"><?php echo $lblDownload?></th>
												<th width="90">Control</th>
												<th width="34"><?php echo $lblId?></th>
												<th width="90"><?php echo $lblGroup?></th>
                                        </tr>
                                    </thead>
									<?php 
										foreach($this->Items as $key => $val){
											$id 				= $val['id'];
											$app_name 			= $val['name_app'];
											$link_app 			= $val['link_app'];
											$link_img 			= $val['link_img'];
											$star 				= $val['star'];
											$date_upload 		= $val['date_upload'];
											$status 			= $val['status'];
											$number_download	= $val['number_download'];
											$group_app 			= $val['group_app'] ;
											
											if($status == 1){	
												$linkStatus = $this->baseUrl($this->currentController . '/status/type/0/id/' . $id);											
												$status = $this->cmsIconButton('Active', $this->imgUrl . '/icon/active.png',$linkStatus);
											}else{
												$linkStatus = $this->baseUrl($this->currentController . '/status/type/1/id/' . $id);
												$status = $this->cmsIconButton('INactive', $this->imgUrl . '/icon/inactive.png',$linkStatus);
											}
											
// 											
											
											$linkInfo		= $this->baseUrl($this->currentController . '/info/id/' . $id);											
											$btnInfo		= $this->cmsIconButton('View Item',$this->imgUrl . '/icon_info.png',$linkInfo);
											
											$linkEdit		= $this->baseUrl($this->currentController . '/edit/id/' . $id);
											$btnEdit		= $this->cmsIconButton('Edit Item',$this->imgUrl . '/icon_edit.png',$linkEdit);
											
											$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id);
											$btnDelete		= $this->cmsIconButton('Delete Item',$this->imgUrl . '/icon_del.png',$linkDelete);
										
											$strIconButton	= $btnInfo . ' ' . $btnEdit . ' ' . $btnDelete;
											
											$cid			= $this->formCheckbox('cid[]',$val['id']);
									?>
                                    <tr class="even">	
                                    					
                                        <td align="center"><?php echo $cid;?></td>
                                        <td align="left"><?php echo  $app_name;?></td>
                                        <td align="center"><?php echo $status?></td>
                                        <td align="center"><?php echo $link_app?></td>
                                        <td align="center"><?php echo $link_img?></td>
                                        <td align="center"><?php echo $star;?></td>

                                        <td align="center"><?php echo $date_upload;?></td>
                                        <td align="center"><?php echo $number_download;?></td>
                                        <td align="center"><?php echo $strIconButton;?></td>
                                        <td align="center"><?php echo $id;?></td>
                                        <td align="center"><?php echo $group_app;?></td>
                                        
                                    </tr>
                                    <?php 
										}
                                    ?>
                                    <!-- BEGIN: PAGINATION (FOOT) -->
                                    <tfoot>
                                        <tr>
                                            <td colspan="9">
                                                <div class="container">
                                                    <div class="pagination">
                                                        <?php 
                                                        	$currentUrl = $this->baseUrl($this->currentController . '/index');
                                                        	echo $this->paginationControl($this->panigator,'Sliding','pagination.phtml',array('currentUrl'=>$currentUrl));
                                                        ?>
                                                        <div class="limit"></div>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>					
                                    </tfoot>				<!-- END: PAGINATION (FOOT) -->
                                </table>
                                <!-- Area 4: In du lieu lay tu database - End -->

                                <!-- END: ELEMENT BOX -->	
                              <div class="clr"></div>
                            </div>
                            <div class="b">
                                <div class="b">
                                    <div class="b"></div>
                                </div>
                            </div>
                        </div>
                        <!-- END: 	CONTENT -->
                    </form>